<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use App\Http\Controllers\Controller;
use App\Repository\UserRepos;
use App\Repository\TypeRepos;
use App\Service\MailServer;

class UserController extends Controller
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    /** @var  UserRepository 注入的UserRepository */
    protected $userRepository;
    protected $typeRepos;
    protected $mailServer;

    /**
     * UserController constructor.
     * 依赖注入
     * @param UserRepository $userRepository
     * 2019-01-06
     * sunday
     */
    public function __construct(UserRepos $userRepository, TypeRepos $typeRepos, MailServer $mailServer)
    {
        $this->userRepository = $userRepository;
        $this->typeRepos = $typeRepos;
        $this->mailServer = $mailServer;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $users = $this->userRepository
            ->getAgeLargerThan(5);

        print_r($users);exit;

    }
    public function list()
    {
    	$course = $this->typeRepos->getListData(100);
    	print_r($course);
    }
    public function sendMail()
    {
    	$result = $this->mailServer->send();
    	print_r($result);exit;
    }













}
